<template>
	<view class="content">
		<view class="noticebox" v-for="(item,index) of list" :key="index" @click="jumpdetails(item.id)">
			<view class="zuo">
				<view class="shang">
					<image src="../../static/icon/lingdan.png" mode=""></image>
					<text>{{item.title}}</text>
				</view>
				<!-- <view class="xia">
					{{item.brief}}
				</view> -->
			</view>
			<view class="you">{{item.create_at|formatDate}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			this.getinfo()
		},
		methods: {
			getinfo(){
				var token =uni.getStorageSync('token')
				if(token==''||token==null){
					uni.reLaunch({
					    url:'../login/login'
					})
				}else{
					this.http({
					 	url:'/api/Page/notice',
					 	method:'POST',
						header:{
							'token':token
						},
					 	success:(res)=>{
							console.log(res)
							this.list = res.data
						},
					 	error:()=>{
					 		uni.showToast({
					 			title:"请求异常"	
					 		})
					 	},	
					 })
				} 
			},
			jumpdetails(id){
				uni.navigateTo({
					url:'./noticedetail?id='+id
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-family: PingFang SC;
		font-weight: 500;
		color:#2b2b2b;
		padding-bottom: 50rpx;
		.noticebox{
			width: 630rpx;
			height: 68rpx;
			background: #FFFFFF;
			box-shadow: 0px 0px 2px 0px rgba(43, 43, 43, 0.18);
			border-radius: 10rpx;
			margin: 20rpx auto;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx 30rpx;
			.zuo{
				
				.shang{
					display: flex;
					align-items: center;
					font-size: 32rpx;
					font-weight: bold;
					image{
						margin-right: 17rpx;
						width: 40rpx;
						height: 40rpx;
					}
				}
				.xia{
					padding-top: 10rpx;
					font-size: 28rpx;
					color: #CCCCCC;
					padding-left: 57rpx;
				}
			}
			.you{
				font-size: 28rpx;
				color: #CCCCCC;
			}
		}
	}

	
</style>
